﻿@model Telerik.Web.Mvc.GridModel<WidgetModel>
@using Telerik.Web.Mvc.UI
@{    
   //page title
   ViewBag.Title = T("Admin.ContentManagement.Widgets").Text;
}
<div class="section-header">
   <div class="title">
       <i class="icon icon-plus-sign-alt"></i>
       @T("Admin.ContentManagement.Widgets")
   </div>
</div>
<table class="adminContent">
   <tr>
       <td>
           @(Html.Telerik().Grid<WidgetModel>()
                   .Name("widgets-grid")
                   .DataKeys(x =>
                   {
                       x.Add(y => y.SystemName).RouteKey("systemName");
                   })
                   .BindTo(Model.Data)
                   .Columns(columns =>
                   {
                       columns.Bound(x => x.FriendlyName)
                           .Width(300)
                           .ReadOnly();
                       columns.Template(
                               @<div>
                                   @Html.ActionLink(T("Admin.ContentManagement.Widgets.Configure").Text, "ConfigureWidget", new { systemName = item.SystemName })
                               </div>
                           )
                           .ClientTemplate("<a href=\"ConfigureWidget?systemName=<#= SystemName #>\">" + T("Admin.ContentManagement.Widgets.Configure").Text + "</a>")
						   .Width(140)
                           .Title(T("Admin.ContentManagement.Widgets.Configure").Text);
                       columns.Bound(x => x.SystemName)
						   .ReadOnly();
                       columns.Bound(x => x.DisplayOrder)
						   .Centered()
                           .Width(100);
                       columns.Bound(x => x.IsActive)
                           .Template(item => @Html.SymbolForBool(item.IsActive))
                           .ClientTemplate(@Html.SymbolForBool("IsActive"))
                           .Centered()
                           .Width(100);
                       columns.Command(commands =>
                       {
                           commands.Edit().Localize(T);
                       }).Title(T("Admin.Common.Edit").Text).Width(100);
                   })
                   .DataBinding(dataBinding =>
                   {
                       dataBinding.Ajax().Select("List", "Widget")
                           .Update("WidgetUpdate", "Widget");
                   })
                   .EnableCustomBinding(true))
       </td>
   </tr>
</table>